package com.vector.demo.service.impl;

import com.vector.demo.mapper.CourseMapper;
import com.vector.demo.pojo.Course;
import com.vector.demo.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {


    @Autowired
    private CourseMapper courseMapper;

    @Override
    public List<Course> selectCourse() {
        return courseMapper.selectAllCourse();
    }

    @Override
    @Transactional
    public Course addCourse(Course course) {
        return courseMapper.addCourse(course);
    }

    @Override
    @Transactional
    public void dropCourseById(int cou_id) {
        courseMapper.dropCourseById(cou_id);
    }

    @Override
    public Course preModifyCourse(int cou_id) {
        return courseMapper.preModifyCourse(cou_id);
    }

    @Override
    @Transactional
    public void modifyCourse(Course course) {
        courseMapper.modifyCourse(course);
    }
}
